package com.mapper;

import com.POJO.User;
import org.apache.ibatis.annotations.*;
import org.springframework.stereotype.Component;

import java.util.List;


/**
 * @Package com.mapper
 * @Date 2024-05-23 11:23
 * 用户相关数据库操作
 */

@Mapper
@Component
public interface UserMapper {
    //根据用户ID取用户信息
    @Select("select * from users where username=#{username}")
    User getUser(String username);


    //获取所有用户信息
    @Select("select * from users")
    List<User> getAllUser();


    //根据用户ID删除用户
//    @Delete("delete from user where userId=#{userId}")
//    int deleteUser(int userId);


    //更新用户信息
    @Update("update users set username=#{username},password=#{password}where userId=#{userId}")
    void updateUser(User user);
}
